Skip to content

Fix spotlight backspace character removal - #4

Open
sonthepham-dev wants to merge 11 commits into
masterfrom
cursor/fix-spotlight-backspace-character-removal-9c1e
Open

Fix spotlight backspace character removal#4
sonthepham-dev wants to merge 11 commits into
masterfrom
cursor/fix-spotlight-backspace-character-removal-9c1e

Conversation

@sonthepham-dev

@sonthepham-dev sonthepham-dev commented Aug 5, 2025

Copy link
Copy Markdown
Owner

Enable Vietnamese input and fix backspace character deletion in Spotlight.

Spotlight was previously in the IGNORED_BUNDLES list, preventing the input method from processing keystrokes. This caused backspace to only clear autocomplete suggestions without deleting characters. The changes remove Spotlight from this list and add specific handling to ensure correct character removal and autocomplete behavior.


Open in Cursor Open in Web

Note

Medium Risk
Touches global key event hook/backspace emission logic and changes the macOS deployment target, which can affect input behavior and app compatibility across systems.

Overview
Improves Spotlight compatibility by treating com.apple.Spotlight as an app needing special “empty character” handling, and adds Spotlight-specific backspace logic (extra backspace + autocomplete clearing) so deletions remove characters rather than only dismissing suggestions.

Adds focused-app tracking via Accessibility (AXUIElementCreateSystemWide + cached lastFocusedAppBundleId) to support per-app ignore behavior, and tweaks language detection to allow the empty language used by “Unicode Hex Input”.

Updates Xcode project settings (deployment target to 11.5 and code-sign identity override), and includes new xcuserdata debugger/breakpoint files in the repo.

Written by Cursor Bugbot for commit 91e7727. This will update automatically on new commits. Configure here.

@cursor

cursor Bot commented Aug 5, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@sonthepham-dev

Copy link
Copy Markdown
Owner Author

@cursoragent describe detail

@cursor

cursor Bot commented Aug 5, 2025

Copy link
Copy Markdown

The previous turn provided a detailed breakdown of the changes made to fix the Spotlight backspace issue, which was preventing characters from being deleted and only clearing autocomplete suggestions.

The core problem was that Spotlight (com.apple.Spotlight) was listed in the IGNORED_BUNDLES array of the OpenKey input method, causing all keystrokes in Spotlight to be ignored. The solution involved several key changes:

  • Enabling Input Processing: Spotlight was removed from the IGNORED_BUNDLES array in Sources/OpenKey/macOS/ModernKey/OpenKey.mm to allow the Vietnamese input method to process its keystrokes.
  • Enhanced Backspace Handling: Special logic was added to the SendBackspace() function and delete key handling to send an additional backspace event when Spotlight is the active application. This ensures that characters are actually removed, not just autocomplete suggestions.
  • Autocomplete Management: Spotlight was added to the _niceSpaceApp array and given specific handling for clearing autocomplete to prevent interference with character deletion.

These changes ensure that Vietnamese input now functions correctly within Spotlight, and the backspace key properly removes characters as expected.


Open in Cursor Open in Web

Learn more about Cursor Agents

@sonthepham-dev
sonthepham-dev marked this pull request as ready for review March 9, 2026 02:33

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Free Tier Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed developer-specific Xcode debug files

Low Severity

Developer-specific Xcode debug files were committed, including breakpoints (some with shouldBeEnabled = "Yes") and debug watch expressions. These xcuserdatad files are personal IDE state and can interfere with other developers' debugging experience.

Additional Locations (1)

Fix in Cursor Fix in Web

} else if (isSpotlightApp(FRONT_APP)) {
// Special handling for Spotlight: send empty character to clear autocomplete
SendEmptyCharacter();
pData->backspaceCount++;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant Spotlight branch duplicates default autocomplete logic

Low Severity

The isSpotlightApp(FRONT_APP) branch (lines 821–824) executes SendEmptyCharacter() and pData->backspaceCount++, which is identical to the default else branch (lines 825–828). Since SendEmptyCharacter() already handles Spotlight-specific behavior internally via the _niceSpaceApp check, this separate branch adds no differentiation and is purely redundant.

Fix in Cursor Fix in Web

// Send an additional backspace to ensure character removal
CGEventTapPostEvent(_proxy, eventBackSpaceDown);
CGEventTapPostEvent(_proxy, eventBackSpaceUp);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SendBackspace doubles every backspace causing potential over-deletion

High Severity

SendBackspace() unconditionally sends an extra backspace for Spotlight on every invocation. When called in a loop (e.g., for backspaceCount iterations during character replacement), this doubles every programmatic backspace. Combined with the autocomplete fix that already calls SendEmptyCharacter() + backspaceCount++ to handle autocomplete dismissal, the total backspaces sent become 2*(N+1) instead of the needed N+1, likely over-deleting text.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants